About the Java L&F

The Java Look and Feel is a cross-platform look & feel being provided by Javasoft. Here is some information about the Java L&F you might find useful.

The Java L&F implements all of the basic Swing functionality, but also extends it in several areas including:

Themes

One of the first things we learned while implementing the Java L&F was than many developers feel very strongly about how colors are used in their software. To help accommodate this we created a Theme mechanism which allows a developer to easily specify the default colors, fonts and icons used by the L&F.

The theme mechanism is designed to allow developers to create their own themes. For an example of this, see the themes which are included with Metalworks. Note, like all of the L&F packages, the metal package is not yet frozen and the theme mechanism may change as we get developer feedback on how to improve it.

Sliders

There are several areas where the Java L&F introduces some optional "value-added" features above the base line capabilities of swing.  One is the option of Filled Sliders. These are ideal for things like volume controls. To access the Java L&F "value-added" features you pass in a token to the component's putClientProperty method. Here is an example:

JSlider slider = new JSlider();
slider.putClientProperty("JSlider.isFilled", Boolean.TRUE);

Note that if a UI such as Windows or Motif encounters a property such as JSlider.fill which is does not understand that property will be ignored.  Thus you don't have to worry about problems which could arise if you switch to a different L&F.

ToolBars

Many popular applications support "roll-over" effects on buttons in toolbars. The Java L&F provides an easy way to do this. Here is a code snippit:

JToolBar toolbar = new JToolBar();
// add your buttons here
toolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

This will remove the borders from around all the buttons in the tool bar, and only show them when the mouse is over a given button.  This is a nice effect for many applications.

Trees

Java L&F allows you to control the line style used in the JTree component. Here are some code snippits:

JTree myTree = new JTree();

// This will provide parent-child connector lines
myTree.putClientProperty("JTree.lineStyle",
                         "Angled");

// This will remove lines from the tree
myTree.putClientProperty("JTree.lineStyle",
                         "None");

// This will provide lines separating root notes
// it is the default setting
myTree.putClientProperty("JTree.lineStyle",
                         "Horizontal"); 

Back